---
layout: api-page
title: "Class: Observable"
id: api
---

<main class="api-documentation-page">
  

  
  

  <section>

  <header>
      
      
      
          
            <h2>
            Observable
            </h2>
          
          
      
  </header>

  <article>
      <div class="container-overview">
      
          
<section class="method-section">
    
        

        <h4 class="name section-header function-name" id="Observable"><span class="type-signature"></span>new Observable<span class="signature">()</span><span class="type-signature return-signature"></span></h4>

        
    

        

    

    

    

    

    




  <dl class="details">

      

      

      

      

      

      

      

      

      

      

      

      

      
      <dt class="tag-source">Source:</dt>
      <dd class="tag-source">
          <a href="typedefs_Observable.js.html">typedefs/Observable.js</a>, <a href="typedefs_Observable.js.html#line2">line 2</a>
      </dd>
      

      

      

      
  </dl>


    

    

    

    

    

    

    
</section>
      
      </div>

      

      

      

       

      

      

      
          <h3 class="subsection-title">Methods</h3>

          
              
<section class="method-section">
    
        

        <h4 class="name section-header function-name" id="forEach"><span class="type-signature"></span>forEach<span class="signature">(onNext<span class="signature-attributes">nullable</span>, onError<span class="signature-attributes">nullable</span>, onCompleted<span class="signature-attributes">nullable</span>)</span><span class="type-signature return-signature"> &rarr; {<a href="Subscription.html">Subscription</a>}</span></h4>

        
    

        
        <div class="description">
            <p>The forEach method is a synonym for Observable.prototype.subscribe and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an Observer object.</p>
        </div>
        

    

    

    

    
        <h5>Parameters:</h5>
        

<div class="parameters-section">
    <table class="params">
        <thead>
        <tr>
            
            <th class="header-name-and-attributes">
              Name
              
                &amp; Attributes
              
            </th>
            

            <th class="header-type">Type</th>

            

            <th class="last header-description">Description</th>
        </tr>
        </thead>

        <tbody>
        

            <tr>
                
                    <td>
                        <span class="name">onNext</span>
                        
                            
                        
                            
                                <br>
                                <span class="attribute">nullable</span>
                            
                        
                            
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type"><a href="Observable.html#~onNextCallback">Observable~onNextCallback</a></span>


                
                </td>

                

                <td class="description last"><p>a callback that accepts the next value in the stream of values</p></td>
            </tr>

        

            <tr>
                
                    <td>
                        <span class="name">onError</span>
                        
                            
                        
                            
                                <br>
                                <span class="attribute">nullable</span>
                            
                        
                            
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type"><a href="Observable.html#~onErrorCallback">Observable~onErrorCallback</a></span>


                
                </td>

                

                <td class="description last"><p>a callback that accepts an error that occurred while evaluating the operation underlying the <a href="Observable.html">Observable</a> stream</p></td>
            </tr>

        

            <tr>
                
                    <td>
                        <span class="name">onCompleted</span>
                        
                            
                        
                            
                                <br>
                                <span class="attribute">nullable</span>
                            
                        
                            
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type"><a href="Observable.html#~onCompletedCallback">Observable~onCompletedCallback</a></span>


                
                </td>

                

                <td class="description last"><p>a callback that is invoked when the <a href="Observable.html">Observable</a> stream has ended, and the <a href="Observable.html#~onNextCallback">Observable~onNextCallback</a> will not receive any more values</p></td>
            </tr>

        
        </tbody>
    </table>
</div>

    

    




  <dl class="details">

      

      

      

      

      

      

      

      

      

      

      

      

      
      <dt class="tag-source">Source:</dt>
      <dd class="tag-source">
          <a href="typedefs_Observable.js.html">typedefs/Observable.js</a>, <a href="typedefs_Observable.js.html#line6">line 6</a>
      </dd>
      

      

      

      
  </dl>


    

    

    

    

    

    
    
    
            


<dl class="return-type">
    <dt>
        Return Type: 
    </dt>
    <dd>
        
<span class="param-type"><a href="Subscription.html">Subscription</a></span>


    </dd>
</dl>

        

    
</section>
          
              
<section class="method-section">
    
        

        <h4 class="name section-header function-name" id="subscribe"><span class="type-signature"></span>subscribe<span class="signature">(onNext<span class="signature-attributes">nullable</span>, onError<span class="signature-attributes">nullable</span>, onCompleted<span class="signature-attributes">nullable</span>)</span><span class="type-signature return-signature"> &rarr; {<a href="Subscription.html">Subscription</a>}</span></h4>

        
    

        
        <div class="description">
            <p>The subscribe method is a synonym for Observable.prototype.forEach and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an Observer object.</p>
        </div>
        

    

    

    

    
        <h5>Parameters:</h5>
        

<div class="parameters-section">
    <table class="params">
        <thead>
        <tr>
            
            <th class="header-name-and-attributes">
              Name
              
                &amp; Attributes
              
            </th>
            

            <th class="header-type">Type</th>

            

            <th class="last header-description">Description</th>
        </tr>
        </thead>

        <tbody>
        

            <tr>
                
                    <td>
                        <span class="name">onNext</span>
                        
                            
                        
                            
                                <br>
                                <span class="attribute">nullable</span>
                            
                        
                            
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type"><a href="Observable.html#~onNextCallback">Observable~onNextCallback</a></span>


                
                </td>

                

                <td class="description last"><p>a callback that accepts the next value in the stream of values</p></td>
            </tr>

        

            <tr>
                
                    <td>
                        <span class="name">onError</span>
                        
                            
                        
                            
                                <br>
                                <span class="attribute">nullable</span>
                            
                        
                            
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type"><a href="Observable.html#~onErrorCallback">Observable~onErrorCallback</a></span>


                
                </td>

                

                <td class="description last"><p>a callback that accepts an error that occurred while evaluating the operation underlying the <a href="Observable.html">Observable</a> stream</p></td>
            </tr>

        

            <tr>
                
                    <td>
                        <span class="name">onCompleted</span>
                        
                            
                        
                            
                                <br>
                                <span class="attribute">nullable</span>
                            
                        
                            
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type"><a href="Observable.html#~onCompletedCallback">Observable~onCompletedCallback</a></span>


                
                </td>

                

                <td class="description last"><p>a callback that is invoked when the <a href="Observable.html">Observable</a> stream has ended, and the <a href="Observable.html#~onNextCallback">Observable~onNextCallback</a> will not receive any more values</p></td>
            </tr>

        
        </tbody>
    </table>
</div>

    

    




  <dl class="details">

      

      

      

      

      

      

      

      

      

      

      

      

      
      <dt class="tag-source">Source:</dt>
      <dd class="tag-source">
          <a href="typedefs_Observable.js.html">typedefs/Observable.js</a>, <a href="typedefs_Observable.js.html#line17">line 17</a>
      </dd>
      

      

      

      
  </dl>


    

    

    

    

    

    
    
    
            


<dl class="return-type">
    <dt>
        Return Type: 
    </dt>
    <dd>
        
<span class="param-type"><a href="Subscription.html">Subscription</a></span>


    </dd>
</dl>

        

    
</section>
          
      

      
          <h3 class="subsection-title">Type Definitions</h3>

          
                  
<section class="method-section">
    
        

        <h4 class="name section-header function-name" id="~onCompletedCallback"><span class="type-signature"></span>onCompletedCallback<span class="signature">()</span><span class="type-signature return-signature"></span></h4>

        
    

        
        <div class="description">
            <p>This callback is invoked when the <a href="Observable.html">Observable</a> stream ends. When this callback is invoked the <a href="Observable.html">Observable</a> stream has ended, and therefore the <a href="Observable.html#~onNextCallback">Observable~onNextCallback</a> will not receive any more values.</p>
        </div>
        

    

    

    

    

    




  <dl class="details">

      

      

      

      

      

      

      

      

      

      

      

      

      
      <dt class="tag-source">Source:</dt>
      <dd class="tag-source">
          <a href="typedefs_Observable.js.html">typedefs/Observable.js</a>, <a href="typedefs_Observable.js.html#line40">line 40</a>
      </dd>
      

      

      

      
  </dl>


    

    

    

    

    

    

    
</section>
              
                  
<section class="method-section">
    
        

        <h4 class="name section-header function-name" id="~onErrorCallback"><span class="type-signature"></span>onErrorCallback<span class="signature">(error)</span><span class="type-signature return-signature"></span></h4>

        
    

        
        <div class="description">
            <p>This callback accepts an error that occurred while evaluating the operation underlying the <a href="Observable.html">Observable</a> stream. When this callback is invoked, the <a href="Observable.html">Observable</a> stream ends and no more values will be received by the <a href="Observable.html#~onNextCallback">Observable~onNextCallback</a>.</p>
        </div>
        

    

    

    

    
        <h5>Parameters:</h5>
        

<div class="parameters-section">
    <table class="params">
        <thead>
        <tr>
            
            <th class="header-name-and-attributes">
              Name
              
            </th>
            

            <th class="header-type">Type</th>

            

            <th class="last header-description">Description</th>
        </tr>
        </thead>

        <tbody>
        

            <tr>
                
                    <td>
                        <span class="name">error</span>
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type">Error</span>


                
                </td>

                

                <td class="description last"><p>the error that occurred while evaluating the operation underlying the <a href="Observable.html">Observable</a></p></td>
            </tr>

        
        </tbody>
    </table>
</div>

    

    




  <dl class="details">

      

      

      

      

      

      

      

      

      

      

      

      

      
      <dt class="tag-source">Source:</dt>
      <dd class="tag-source">
          <a href="typedefs_Observable.js.html">typedefs/Observable.js</a>, <a href="typedefs_Observable.js.html#line34">line 34</a>
      </dd>
      

      

      

      
  </dl>


    

    

    

    

    

    

    
</section>
              
                  
<section class="method-section">
    
        

        <h4 class="name section-header function-name" id="~onNextCallback"><span class="type-signature"></span>onNextCallback<span class="signature">(value)</span><span class="type-signature return-signature"></span></h4>

        
    

        
        <div class="description">
            <p>This callback accepts a value that was emitted while evaluating the operation underlying the <a href="Observable.html">Observable</a> stream.</p>
        </div>
        

    

    

    

    
        <h5>Parameters:</h5>
        

<div class="parameters-section">
    <table class="params">
        <thead>
        <tr>
            
            <th class="header-name-and-attributes">
              Name
              
            </th>
            

            <th class="header-type">Type</th>

            

            <th class="last header-description">Description</th>
        </tr>
        </thead>

        <tbody>
        

            <tr>
                
                    <td>
                        <span class="name">value</span>
                        
                    </td>
                

                <td class="type">
                
                    
<span class="param-type">Object</span>


                
                </td>

                

                <td class="description last"><p>the value that was emitted while evaluating the operation underlying the <a href="Observable.html">Observable</a></p></td>
            </tr>

        
        </tbody>
    </table>
</div>

    

    




  <dl class="details">

      

      

      

      

      

      

      

      

      

      

      

      

      
      <dt class="tag-source">Source:</dt>
      <dd class="tag-source">
          <a href="typedefs_Observable.js.html">typedefs/Observable.js</a>, <a href="typedefs_Observable.js.html#line28">line 28</a>
      </dd>
      

      

      

      
  </dl>


    

    

    

    

    

    

    
</section>
              
      

      
  </article>

  </section>
  

  
</main>



        
        <!--
          In case someone comes along later and sees the active item on the
          toc acting weirdly, hopefully they'll see this comment. This page, unlike
          any seen during development, has multiple 'docs' passed to container.tmpl.
          To debug it and enhance the page as needed, I would suggest looking there first.
        -->
        

        <!-- Generate the table of contents -->
        <nav class="table-of-contents api-doc-toc">
            <ul class="nav">
                <li>
                    <a href="DataSource.html">Classes</a>
                    <ul class="toc-api-classes">
                        
                            <li class="toc-api-class ">
                                <a href="DataSource.html" data-target="#DataSource">DataSource</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="DataSource.html#call" data-target="#call">call</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="DataSource.html#get" data-target="#get">get</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="DataSource.html#set" data-target="#set">set</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="FromEsObserverAdapter.html" data-target="#FromEsObserverAdapter">FromEsObserverAdapter</a>
                                
                                


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="HttpDataSource.html" data-target="#HttpDataSource">HttpDataSource</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="HttpDataSource.html#call" data-target="#call">call</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="HttpDataSource.html#get" data-target="#get">get</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="HttpDataSource.html#set" data-target="#set">set</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="Model.html" data-target="#Model">Model</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#_setMaxSize" data-target="#_setMaxSize">_setMaxSize</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#asDataSource" data-target="#asDataSource">asDataSource</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#batch" data-target="#batch">batch</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#boxValues" data-target="#boxValues">boxValues</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#call" data-target="#call">call</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#deref" data-target="#deref">deref</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#get" data-target="#get">get</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#getCache" data-target="#getCache">getCache</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#getPath" data-target="#getPath">getPath</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#getVersion" data-target="#getVersion">getVersion</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#invalidate" data-target="#invalidate">invalidate</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#preload" data-target="#preload">preload</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#set" data-target="#set">set</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#setCache" data-target="#setCache">setCache</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#treatErrorsAsValues" data-target="#treatErrorsAsValues">treatErrorsAsValues</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#unbatch" data-target="#unbatch">unbatch</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#unboxValues" data-target="#unboxValues">unboxValues</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#withoutDataSource" data-target="#withoutDataSource">withoutDataSource</a>
            </li>
         
    </ul>


                                

    <ul class="toc-api-subgroup toc-api-subgroup-types">
        <li>
            <span class="toc-api-subgroup-title">Types</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#~comparator" data-target="#\~comparator">comparator</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#~errorSelector" data-target="#\~errorSelector">errorSelector</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#~onChange" data-target="#\~onChange">onChange</a>
            </li>
         
    </ul>


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="ModelResponse.html" data-target="#ModelResponse">ModelResponse</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="ModelResponse.html#forEach" data-target="#forEach">forEach</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="ModelResponse.html#progressively" data-target="#progressively">progressively</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="ModelResponse.html#subscribe" data-target="#subscribe">subscribe</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="ModelResponseObserver.html" data-target="#ModelResponseObserver">ModelResponseObserver</a>
                                
                                


                                


                                


                            </li>
                        
                            <li class="toc-api-class current-page">
                                <a href="Observable.html" data-target="#Observable">Observable</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#forEach" data-target="#forEach">forEach</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#subscribe" data-target="#subscribe">subscribe</a>
            </li>
         
    </ul>


                                

    <ul class="toc-api-subgroup toc-api-subgroup-types">
        <li>
            <span class="toc-api-subgroup-title">Types</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#~onCompletedCallback" data-target="#\~onCompletedCallback">onCompletedCallback</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#~onErrorCallback" data-target="#\~onErrorCallback">onErrorCallback</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#~onNextCallback" data-target="#\~onNextCallback">onNextCallback</a>
            </li>
         
    </ul>


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="Subscription.html" data-target="#Subscription">Subscription</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Subscription.html#dispose" data-target="#dispose">dispose</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="ToEsSubscriptionAdapter.html" data-target="#ToEsSubscriptionAdapter">ToEsSubscriptionAdapter</a>
                                
                                


                                


                                


                            </li>
                        
                    </ul>
                </li>
                <li class="toc-api-type-list ">
                    <a href="global.html">Global Types</a>
                    <ul class="toc-api-types">
                        
                            <li class="toc-api-type">
                                <a href="global.html#Atom" data-target="#Atom">Atom</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#JSONEnvelope" data-target="#JSONEnvelope">JSONEnvelope</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#JSONGraph" data-target="#JSONGraph">JSONGraph</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#JSONGraphEnvelope" data-target="#JSONGraphEnvelope">JSONGraphEnvelope</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#Key" data-target="#Key">Key</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#KeySet" data-target="#KeySet">KeySet</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#Path" data-target="#Path">Path</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#PathSet" data-target="#PathSet">PathSet</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#PathValue" data-target="#PathValue">PathValue</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#Range" data-target="#Range">Range</a>
                            </li>
                        
                    </ul>
                </li>
            </ul>
        </nav>